#pragma managed

#include "Face.h"
#include "../USISlave.h"

using namespace System;
using namespace System::Threading;
using namespace USI;

void AddPoint(bool check)
{
	Monitor::Enter(USISlave::GetThis());
	if (check)
		if (settings.bCRC)
			USISlave::GetThis()->AddWork(CHECK_WDH_CRC);
		else
			USISlave::GetThis()->AddWork(CHECK_WDH);
	else
		USISlave::GetThis()->AddWork(1);
	Monitor::Exit(USISlave::GetThis());
}

void AddResLine(int rsn, int warn, const TCHAR *path, const TCHAR *name)
{
	String ^rsnText;
	switch (rsn)
	{
		case RSN_DEL:
			rsnText = "Deleted";
			break;
		case RSN_NEW:
			rsnText = "Added";
			break;
		case RSN_MOD:
			rsnText = "Modified";
			break;
	}

	String ^warnText;
	switch (warn)
	{
		case RSN_DANG:
			warnText = "Danger!";
			break;
		case RSN_WARN:
			warnText = "Warning";
			break;
		case RSN_INFO:
			warnText = "Notification";
			break;
		case RSN_NONE:
			warnText = "Information";
			break;
	}

	ResultRecord ^res = gcnew ResultRecord(rsnText, warnText, USI::Converter::ToNetString(path), USI::Converter::ToNetString(name));

	USISlave::GetThis()->AddResult(res);
}
